<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>密码重置 - 有间工作室</title>
	<link rel="stylesheet" type="text/css" href="/static/index/style/register-login.css">
	<link rel="stylesheet" href="/static/index/css/jigsaw.css">
	<script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
	<script src="/static/index/js/vector.js"></script>
	<script>
		$(function () {
			var victor = new Victor("container", "output")
		})
	</script>
</head>

<body id="container">
	<div id="output">
		<div class="cent-box-header">
			<h1 class="main-title hide">有间</h1>
		</div>
		<div class="cent-box">
			<div class="cont-main clearfix">
				<div class="index-tab">
					<div class="index-slide-nav">
						<a href="{{url_for('.reset_pwd')}}"  class="active">&nbsp;&nbsp;重 置 密 码</a>
						<div class="slide-bar"></div>
					</div>
				</div>
				<div class="login form">
					<div class="group">
						<div class="group-ipt password">
							<input type="password" name="password" id="password" class="ipt" placeholder="输入密码"
								required>
						</div>
						<div class="group-ipt password">
							<input type="password" name="password1" id="password1" class="ipt" placeholder="确认密码"
								required>
						</div>
						<div id="captcha" class="group-ipt" style="position: relative"></div>
					</div>
				</div>
				<div class="button">
					<button type="submit" class="login-btn register-btn" id="button">保存</button>
				</div>
				<a href="{{url_for('.login')}}" style="color:#f7a280;">返 回 登 录</a>
                <a href="{{url_for('.register')}}" style="margin-left:130px; color:#f7a280">注 册 新 用 户</a>
			</div>
		</div>
	</div>

	<script src='/static/index/js/background.js' type="text/javascript"></script>
	<script src='/static/index/js/jquery.min.js' type="text/javascript"></script>
	<script src='/static/index/js/layer/layer.js' type="text/javascript"></script>
	<script src='/static/index/js/index.js' type="text/javascript"></script>
	<script src="/static/index/js/jigsaw.js" type="text/javascript"></script>
	<script>
		$("#remember-me").click(function () {
			var n = document.getElementById("remember-me").checked;
			if (n) {
				$(".zt").show();
			} else {
				$(".zt").hide();
			}
		});
		var verify = ""
		jigsaw.init(document.getElementById('captcha'), function () {
			verify = "success";
			layer.msg("验证成功")
		}, function () {
			verify = "loser";
			layer.msg("验证失败")
		})

		$('.login-btn').click(function () {
			var password = $('#password').val()
			var password1 = $('#password1').val()
			$.ajax({
				url: "{{url_for('.reset_pwd')}}",
				type: "post",
				data: {
					"password": password,
					"password1": password1,
					"verify": verify
				},
				success: function (data) {
					errno = data.errno;
					errmsg = data.errmsg;
					layer.msg(errmsg);
					if (errno == 0) {
						layer.msg(errmsg);
						setTimeout(function () {
							window.location.href = "{{url_for('.login')}}"
						}, "1500");
					}
				}
			})
		})

		$("#remember-me").click(function () {
			var n = document.getElementById("remember-me").checked;
			if (n) {
				$(".zt").show();
			} else {
				$(".zt").hide();
			}
		});
	</script>
</body>

</html>